package edu.cibertec.sicsolutions.vfs.dao.votacion.ibatis;
import java.util.List;
import java.util.Map;

import edu.cibertec.sicsolutions.exception.DaoException;
import edu.cibertec.sicsolutions.vfs.dao.votacion.SessionTrackingDao;
import edu.cibertec.sicsolutions.vfs.domain.votacion.SessionTracking;
import edu.cibertec.sicsolutions.vfs.spring.SpringIbatisBase;

/**
 * Data Access Object Implementation of table SESSION_TRACKING 
 * @author enrique.vargas
 *
 */
public class SessionTrackingDaoImpl extends SpringIbatisBase implements SessionTrackingDao {	

	public SessionTracking getSessionTrackingByPk(SessionTracking sessionTracking) throws DaoException{
		try{
			return (SessionTracking)queryForObject("getSessionTrackingByPk", sessionTracking);
		} catch(Exception e){
			log.error(e.getMessage(), e);
			throw new DaoException(e.getMessage(), e);
		}		
	}
	
	public void insertSessionTracking(SessionTracking sessionTracking) throws DaoException{
		try{
			insert("insertSessionTracking", sessionTracking);
		} catch(Exception e){
			log.error(e.getMessage(), e);
			throw new DaoException(e.getMessage(), e);
		}		
	}
	
	public void updateSessionTracking(SessionTracking sessionTracking) throws DaoException{		
		try{
			update("updateSessionTracking", sessionTracking);
		} catch(Exception e){
			log.error(e.getMessage(), e);
			throw new DaoException(e.getMessage(), e);
		}
	}
	
	public void updateSessionTrackingByMap(Map map) throws DaoException{		
		try{
			update("updateSessionTrackingByMap", map);
		} catch(Exception e){
			log.error(e.getMessage(), e);
			throw new DaoException(e.getMessage(), e);
		}
	}
	
	public void deleteSessionTrackingByPk(SessionTracking sessionTracking) throws DaoException{		
		try{
			delete("deleteSessionTrackingByPk", sessionTracking);
		} catch(Exception e){
			log.error(e.getMessage(), e);
			throw new DaoException(e.getMessage(), e);
		}
	}
	
	public SessionTracking[] findSessionTrackingByClass(SessionTracking sessionTracking) throws DaoException{
		try{
			List list = queryForList("findSessionTrackingByClass", sessionTracking);
			return (SessionTracking[])list.toArray(new SessionTracking[list.size()]);
		} catch(Exception e){
			log.error(e.getMessage(), e);
			throw new DaoException(e.getMessage(), e);
		}
	}

	public SessionTracking[] resultElectoresOnLineByConsulado(Map map)
			throws DaoException {
		try{
			List list = queryForList("resultElectoresOnLineByConsulado", map);
			return (SessionTracking[])list.toArray(new SessionTracking[list.size()]);
		} catch(Exception e){
			log.error(e.getMessage(), e);
			throw new DaoException(e.getMessage(), e);
		}
	}
}